package com.fundamentalesandroid;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class LifeCycleTest extends Activity {
	StringBuilder builder=new StringBuilder();
	TextView textView;
	
	private void log(String text){
		Log.d("LifeCycleTest",text);
		builder.append(text);
		builder.append("\n");
		textView.setText(builder.toString());
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.textView=new TextView(this);
		this.textView.setText(builder.toString());
		this.setContentView(this.textView);
		log("created");
	}

	@Override
	protected void onPause() {
		super.onPause();
		log("paused");
		if(this.isFinishing()){
			log("finishing");
		}
	}

	@Override
	protected void onResume() {
		super.onResume();
		log("resumed");
	}
	
}
